using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using KHMI.Attributes;

namespace DrawTools
{
    [Serializable]
	public class DrawEllipse : DrawRectangle
	{
		public DrawEllipse() : this(0, 0, 1, 1)
		{
		}

        public DrawEllipse(int x, int y, int width, int height) : base()
        {
            Rectangle = new Rectangle(x, y, width, height);
            Initialize();
        }

        /// <summary>
        /// Clone this instance
        /// </summary>
        public override DrawObject Clone(DrawObject drawObject)
        {
            base.Clone(drawObject);
            DrawEllipse drawEllipse = drawObject as DrawEllipse;
            return this;
        }


        public override void Draw(Graphics g)
        {
            Pen pen = new Pen(Color, PenWidth);
            
            g.DrawEllipse(pen, DrawRectangle.GetNormalizedRectangle(Rectangle));
            g.FillEllipse(getBrush(DrawRectangle.GetNormalizedRectangle(Rectangle), DrawType.Ellipse), 
                DrawRectangle.GetNormalizedRectangle(Rectangle));
            pen.Dispose();
        }

	}
}
